<script>
import {computed, watch, ref, unref, reactive, toRefs} from "vue";
import request from "@/api/request";
import * as Vue from "lodash-es";

export const codeList = data => {
  return request.request({
    url: 'api/sys/code/data/list',
    params: data,
    method: 'GET'
  })
}
export const fileList = data => {
  return request.request({
    url: 'api/sys/oss/list',
    params: data,
    method: 'GET'
  })
}
const xmid='';
const xmmc='';

const report_index = {
  "ri10": "重大水利工程",
  "ri2": "主要支流治理",
  "ri4": "大中型病险水库除险加固",
  "ri5": "大中型病险水闸除险加固",
  "ri3": "新建中型水库工程",
  "ri30": "新建小型水库工程",
  "ri40": "小型病险水库除险加固",
  "ri108": "水系连通及农村水系综合整治试点",
  "ri111": "中小河流治理",
  "ri112": "标准海堤建设",
};
const getReportIndexName = (reportindex) => {
  return report_index[reportindex]
}

//市县下拉联动
const shiData=ref([]);
const xianData=ref([]);
const shi = ref();
const xian = ref();
codeList({'superid':'450000'}).then((response)=>{
  shiData.value = response.data.map(item =>({value : item.value, label : item.name}));
  codeList({'superid':shiData.value[0].value}).then((response)=>{
    xianData.value = response.data.map(item =>({value : item.value, label : item.name}));
  })
})

const ChangeShi = value => {
  codeList({'superid':value.value}).then((response)=>{
    xianData.value = response.data.map(item =>({value : item.value, label : item.name}));
  })
};

export default {
  xmid, // 项目ID
  xmmc, // 项目名称
  codeList,
  fileList,
  shiData,
  xianData,
  shi,
  xian,
  ChangeShi,
  getReportIndexName, //项目类型
}
</script>
